//// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
//package com.linqingying.gitcode
//
//import com.intellij.icons.AllIcons
//import com.intellij.openapi.actionSystem.ActionUpdateThread
//import com.intellij.openapi.actionSystem.AnActionEvent
//import com.intellij.openapi.components.service
//import com.intellij.openapi.project.DumbAwareAction
//import com.linqingying.gitcode.i18n.GitCodeBundle
//import com.linqingying.gitcode.icons.GitCodeIcons
//import com.linqingying.gitcode.pullrequest.ui.toolwindow.model.GCPRToolWindowViewModel
//import java.util.function.Supplier
//
//class GitCodeViewPullRequestsAction :
//  DumbAwareAction(GitCodeBundle.messagePointer("pull.request.view.list"),
//                  Supplier { null },
//    GitCodeIcons.  GIT_CODE_ICON) {
//
//  override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT
//
//  override fun update(e: AnActionEvent) {
//    e.presentation.isEnabledAndVisible = isEnabledAndVisible(e)
//  }
//
//  private fun isEnabledAndVisible(e: AnActionEvent): Boolean {
//    val project = e.project ?: return false
//    return project.service<GCPRToolWindowViewModel>().isAvailable.value
//  }
//
//  override fun actionPerformed(e: AnActionEvent) {
//    e.project!!.service<GCPRToolWindowViewModel>().activateAndAwaitProject {
//      viewList()
//    }
//  }
//}
